#include <functional>
#include <map>
#include <any>
#include <string>

using namespace std;

class plugin
{
public:

    template<typename T,typename ...Args>
    void registerType(string key,function<T(Args...)> func)
    {
        if(m_map.find(key) == m_map.end())
        {
            m_map.emplace(key, func);
        }
    }

    template<typename T,typename ...Args>
    function<T(Args...)> find_func(string key)
    {
        if (m_map.find(key) != m_map.end())
		{
			any func = m_map[key];
            function<T(Args...)> f = any_cast<function<T(Args...)>>(func);
            return f;
		}
        return nullptr;
        
    }

protected:


private:
    map<string,any> m_map;
};